package com.google.code.virtualhockey.vhx.client.srvcom;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * CommandResponse that is created following a command dispatch.
 */
public class CommandResponse extends JavaScriptObject {

  protected CommandResponse () {}

  public final native String getCommandName() /*-{
    return this.cmd;
  }-*/;

  public final native String getStatus() /*-{
    return this.status;
  }-*/;

  public final native boolean isOk() /*-{
    return this.status == "OK";
  }-*/;

  public final native JavaScriptObject getResult() /*-{
    if ( typeof "result" == "undefined" )
      return null;
    else
      return this.result;
  }-*/;

  public final native String getErrorType() /*-{
    if ( typeof "errType" == "undefined" )
      return null;
    else
      return this.errType;
  }-*/;

  public final native String getErrorMessage() /*-{
    if ( typeof "errMsg" == "undefined" )
      return null;
    else
      return this.errMsg;
  }-*/;

  public final native String getErrorTrace() /*-{
    if ( typeof "errTrace" == "undefined" )
      return null;
    else
      return this.errTrace;
  }-*/;
}
